package com.qcit.api

import android.app.Activity
import com.qcit.api.cache.RouteCacheData

class AParameterManager private constructor(){
    val PARAMETE_FILE_NAME = "AParameter$$"
    val APT_PACKAGE_DEFULT = "com.qcit.apt"//APT存放的包名
    companion object{
        val instance: AParameterManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            AParameterManager() }
    }
    fun load(aty:Activity){

        var className = aty::class.simpleName
        var parameterLoad = RouteCacheData.parameterCache[className]
        if (null == parameterLoad){
            //获取当前页面对应的辅助类
            var aClass = Class.forName(APT_PACKAGE_DEFULT+"."+PARAMETE_FILE_NAME+className)
            parameterLoad = aClass.newInstance() as AParameterGet
            RouteCacheData.parameterCache.put(className,parameterLoad)
        }
        parameterLoad.getParameter(aty)
    }
}